package uk.ac.ncl.teach.ex.people;

/** 
 * UsePersonEquals - demonstration of asymmetry of Person hierarchy equals 
 * method.
 *
 * @author Nick Cook &lt;nick.cook@ncl.ac.uk&gt;
 * @version svn: $Revision: 1498 $<br />
 * $Date: 2010-11-09 15:39:26 +0000 (Tue, 09 Nov 2010) $<br />
 * Copyright (C) 2009 Newcastle University, UK
 */

public class UsePersonEquals {
    
    public static void main(String[] args) {
        final Person n1 = new Person("Nick", 49);
        final Person n2 = new Person("Nick", 49);
        
        System.out.println("n1 == n2: " + (n1 == n2));
        System.out.println("n1.equals(n2): " + n1.equals(n2));
              
        /*
        final Person n3
            = new UniversityPerson("Nick", 49, "Newcastle Uni");
        
        System.out.println("n1.equals(n3): " + n1.equals(n3));
        System.out.println("n3.equals(n1): " + n3.equals(n1));
        */
                       
        /* 
        System.out.println("n1.equals(n2): " + n1.equals(n2));
        System.out.println("n1.hashCode() == n2.hashCode(): "
            + (n1.hashCode() == n2.hashCode()));
        */
    }
}
